import { axios } from '@/utils/request'

/**
 * 登录方法
 * @param tenantId
 * @param username
 * @param password
 * @param code
 * @param uuid
 * @returns {*}
 */
export function login(tenantId,username, password, code, uuid) {
  const data = {
    tenantId,
    username,
    password,
    code,
    uuid
  }
  return axios({
    url: '/admin/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

/**
 * 注册方法
 * @param data
 * @returns {*}
 */
export function register(data) {
  return axios({
    url: '/admin/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

/**
 * 获取用户详细信息
 * @returns {*}
 */
export function getInfo() {
  return axios({
    url: '/admin/getInfo',
    method: 'get'
  })
}

/**
 * 退出方法
 * @returns {*}
 */
export function logout() {
  return axios({
    url: '/admin/logout',
    method: 'post'
  })
}

/**
 * 获取验证码
 * @returns {*}
 */
export function getCodeImg() {
  return axios({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

/**
 * 短信验证码
 * @returns {*}
 */
export function getCodeSms() {
  return axios({
    url: '/captchaSms',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

/**
 * 获取租户列表
 * @param isToken
 * @returns {AxiosPromise}
 */
export function getTenantList(isToken) {
  return axios({
    url: '/admin/tenant/list',
    headers: {
      isToken: isToken
    },
    method: 'get'
  });
}
